package com.jnshu.service;

import com.jnshu.dto.course.CourseDto;
import com.jnshu.pojo.User;
import com.jnshu.tools.resultUtils.ResultBean;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "learning", url = "http://localhost:20822")
public interface LearningService {

    //文章列表
    @GetMapping("/cotent/list")
    ResultBean uSelectContentList(@RequestParam(value = "grade", required = false) Integer grade,
                                  @RequestParam(value = "subject", required = false) Integer subject,
                                  @RequestParam(value = "classify", required = false) Integer classify,
                                  @RequestParam(value = "type", required = false) Integer type,
                                  @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                  @RequestParam(value = "pageNum", required = false) Integer pageNum,
                                  @RequestParam(value = "userId", required = false) Long userId

    );


    //文章搜索
    @GetMapping("/ucotent")
    ResultBean uSelectContent(@RequestParam(value = "title", required = false) String title,
                              @RequestParam(value = "classify", required = false) Integer classify,
                              @RequestParam(value = "pageSize", required = false) Integer pageSize,
                              @RequestParam(value = "pageNum", required = false) Integer pageNum,
                              @RequestParam(value = "userId", required = false) Long userId);


    //文章详情
    @GetMapping("/cotent/details")
    ResultBean selectByPrimaryKey(@RequestParam(value = "id", required = false) Long id,
                                  @RequestParam(value = "userId", required = false) Long userId);

    //视频详情
    @GetMapping("/video/details")
    ResultBean selectByPrimaryKeyVideo(@RequestParam(value = "id", required = false) Long id,
                                       @RequestParam(value = "userId", required = false) Long userId);

    //收藏
    @PostMapping("/search/collection")
    ResultBean insert(@RequestParam(value = "classify", required = false) Integer classify,
                      @RequestParam(value = "courseId", required = false) Long courseId,
                      @RequestParam(value = "userId", required = false) Long userId);

    //收藏状态
    @GetMapping("/search/collection")
    ResultBean selectStatus(@RequestParam(value = "courseId", required = false) Long courseId,
                            @RequestParam(value = "userId", required = false) Long userId);

    //取消收藏
    @DeleteMapping("/search/collection")
    ResultBean deleteStatus(@RequestParam(value = "courseId", required = false) Long courseId,
                            @RequestParam(value = "userId", required = false) Long userId);

    //获取记录
    @GetMapping("/search/history")
    ResultBean getHistory(@RequestParam(value = "classify", required = false) Integer classify,
                          @RequestParam(value = "userId", required = false) String userId);

    //删除记录
    @DeleteMapping("/search/history")
    ResultBean deleteHistory(@RequestParam(value = "classify", required = false) Integer classify,
                             @RequestParam(value = "userId", required = false) String userId);

    //    任务状态
    @GetMapping("/task/details")
    ResultBean selectByStatus(@RequestParam(value = "taskId", required = false) Long taskId,Long userId);
}

